package com.ymttest.business.service;

import java.io.IOException;
import com.ymatou.iapi.smsproxy.parameter.SendMessageBean;
import com.ymatou.iapi.smsproxy.parameter.SmsCallBackBean;
import com.ymatou.iapi.smsproxy.service.SendMessageCall;
import com.ymt.core.tool.Logger;
import com.ymttest.utils.TestDataManager;

import org.apache.http.client.ClientProtocolException;


/************************************************************************************
 * @File name :SendSmsCallService.java
 * @Author : zhouyi
 * @Date : 2017年12月5日
 * @Copyright : 洋码头
 ************************************************************************************/
public class SendSmsCallService {
	public static String TESTPHONE="13585777478";
	/**
	 * 发送短信
	 * @param appid app-java-teleSign
	 * @param phone
	 * @param content
	 * @return
	 * @throws ClientProtocolException
	 * @throws IOException
	 */
	public static SendMessageCall sendMessage(String appid,String phone,String content) throws ClientProtocolException, IOException {
		SendMessageBean sendmessageBean=new SendMessageBean();
		SendMessageCall sendmessageCall=new SendMessageCall();
		sendmessageBean.setAppId(appid);
		sendmessageBean.setPhone(phone);
		sendmessageBean.setContent(content);
		sendmessageCall.setData(sendmessageBean);
		sendmessageCall.callService();
		return sendmessageCall;			
	}
	/**
	 * 初始化callback
	 * @param id
	 * @param appid
	 * @param phone
	 * @param content
	 * @return
	 */
	public static SmsCallBackBean initSmsCallBackBean(String id,String appid,String phone,String content){
		SmsCallBackBean SmsCallBackBean=new SmsCallBackBean();
		SmsCallBackBean.setApiName("SendMessage");
		SmsCallBackBean.setAppId(appid);
		SmsCallBackBean.setClientIp(TestDataManager.getRandomIp());
		SmsCallBackBean.setContent(content);
		SmsCallBackBean.setId(id);
		SmsCallBackBean.setPhone(phone);
		SmsCallBackBean.setServerIp(TestDataManager.getRandomIp());
		return SmsCallBackBean;
	}
}
